/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Cadastra.java
 *
 * Created on 16/11/2011, 17:11:56
 */
package gerenciadorescola.view;

import gerenciadorescola.model.pattern.facade.Fachada;
import java.awt.Image;
import java.awt.Toolkit;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Pedro Freitas
 */
public class Cadastra extends javax.swing.JFrame {

    /** Creates new form Cadastra */
    public Cadastra() {
        initComponents();
        try {
            Image icon = Toolkit.getDefaultToolkit().getImage("src/gerenciadorescola/imagens/uff.png");
            setIconImage(icon);
        } catch (Exception e) {
            e.getStackTrace();
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        buttonGroup4 = new javax.swing.ButtonGroup();
        buttonGroup5 = new javax.swing.ButtonGroup();
        cadastrarTabbedPane = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        nomeTLabel = new javax.swing.JLabel();
        nomeTText = new javax.swing.JTextField();
        serieLabel = new javax.swing.JLabel();
        serieComboBox = new javax.swing.JComboBox();
        turnoLabel = new javax.swing.JLabel();
        turnoComboBox = new javax.swing.JComboBox();
        linguaTLabel = new javax.swing.JLabel();
        inglesTRadioButton = new javax.swing.JRadioButton();
        espanholTRadioButton = new javax.swing.JRadioButton();
        francesTRadioButton = new javax.swing.JRadioButton();
        cadastrarTButton = new javax.swing.JButton();
        voltarTButton = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        nomeALabel = new javax.swing.JLabel();
        nomeAText = new javax.swing.JTextField();
        matriculaLabel = new javax.swing.JLabel();
        matriculaText = new javax.swing.JTextField();
        idadeALabel = new javax.swing.JLabel();
        idadeAText = new javax.swing.JTextField();
        cpfALabel = new javax.swing.JLabel();
        cpfAText = new javax.swing.JTextField();
        sexoALabel = new javax.swing.JLabel();
        mascARadioButton = new javax.swing.JRadioButton();
        femARadioButton = new javax.swing.JRadioButton();
        telALabel = new javax.swing.JLabel();
        telAText = new javax.swing.JTextField();
        endALabel = new javax.swing.JLabel();
        endAText = new javax.swing.JTextField();
        nometurmaLabel = new javax.swing.JLabel();
        codTurmaAText = new javax.swing.JTextField();
        linguaALabel = new javax.swing.JLabel();
        inglesARadioButton = new javax.swing.JRadioButton();
        espanholARadioButton = new javax.swing.JRadioButton();
        francesARadioButton = new javax.swing.JRadioButton();
        cadastrarAButton = new javax.swing.JButton();
        voltarAButton = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        nomeFLabel = new javax.swing.JLabel();
        nomeFText = new javax.swing.JTextField();
        idadeFLabel = new javax.swing.JLabel();
        idadeFText = new javax.swing.JTextField();
        cpfFLabel = new javax.swing.JLabel();
        cpfFText = new javax.swing.JTextField();
        sexoFLabel = new javax.swing.JLabel();
        mascFRadioButton = new javax.swing.JRadioButton();
        femFRadioButton = new javax.swing.JRadioButton();
        telFLabel = new javax.swing.JLabel();
        telFText = new javax.swing.JTextField();
        endFLabel = new javax.swing.JLabel();
        endFText = new javax.swing.JTextField();
        salarioLabel = new javax.swing.JLabel();
        salarioText = new javax.swing.JTextField();
        cadastrarFButton = new javax.swing.JButton();
        voltarFButton = new javax.swing.JButton();
        disciplinaLabel = new javax.swing.JLabel();
        disciplinaText = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        dirRadioButton = new javax.swing.JRadioButton();
        profRadioButton = new javax.swing.JRadioButton();
        codTurmaPLabel = new javax.swing.JLabel();
        codTurmaPText = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Cadastrar - Escola TPA");

        nomeTLabel.setText("Nome :");

        serieLabel.setText("Série :");

        serieComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1ª", "2ª", "3ª" }));

        turnoLabel.setText("Turno :");

        turnoComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "manhã", "tarde", "noite" }));

        linguaTLabel.setText("Língua Estrangeira :");

        buttonGroup1.add(inglesTRadioButton);
        inglesTRadioButton.setText("Inglês");

        buttonGroup1.add(espanholTRadioButton);
        espanholTRadioButton.setText("Espanhol");

        buttonGroup1.add(francesTRadioButton);
        francesTRadioButton.setText("Francês");

        cadastrarTButton.setText("Cadastrar");
        cadastrarTButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastrarTButtonActionPerformed(evt);
            }
        });

        voltarTButton.setText("Voltar");
        voltarTButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                voltarTButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(serieLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(769, 769, 769))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(linguaTLabel)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(espanholTRadioButton)
                            .addComponent(inglesTRadioButton)
                            .addComponent(francesTRadioButton))
                        .addContainerGap(182, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                        .addComponent(nomeTLabel)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(nomeTText))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                        .addGap(44, 44, 44)
                                        .addComponent(serieComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(52, 52, 52)
                                        .addComponent(turnoLabel)
                                        .addGap(18, 18, 18)
                                        .addComponent(turnoComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(18, 18, 18))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addComponent(cadastrarTButton)
                                .addGap(27, 27, 27)))
                        .addComponent(voltarTButton, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeTLabel)
                    .addComponent(nomeTText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(serieLabel)
                    .addComponent(serieComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(turnoLabel)
                    .addComponent(turnoComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(linguaTLabel)
                    .addComponent(inglesTRadioButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(espanholTRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(francesTRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 185, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(voltarTButton)
                    .addComponent(cadastrarTButton))
                .addContainerGap())
        );

        cadastrarTabbedPane.addTab("Turma", jPanel1);

        nomeALabel.setText("Nome :");

        matriculaLabel.setText("Matrícula :");

        idadeALabel.setText("Idade :");

        cpfALabel.setText("CPF :");

        sexoALabel.setText("Sexo :");

        buttonGroup2.add(mascARadioButton);
        mascARadioButton.setText("M");

        buttonGroup2.add(femARadioButton);
        femARadioButton.setText("F");

        telALabel.setText("Telefone :");

        endALabel.setText("Endereço :");

        nometurmaLabel.setText("Turma :");

        linguaALabel.setText("Lingua Estrangeira :");

        buttonGroup3.add(inglesARadioButton);
        inglesARadioButton.setText("Inglês");

        buttonGroup3.add(espanholARadioButton);
        espanholARadioButton.setText("Espanhol");

        buttonGroup3.add(francesARadioButton);
        francesARadioButton.setText("Francês");

        cadastrarAButton.setText("Cadastrar");
        cadastrarAButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastrarAButtonActionPerformed(evt);
            }
        });

        voltarAButton.setText("Voltar");
        voltarAButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                voltarAButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(nometurmaLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(codTurmaAText, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(linguaALabel)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(espanholARadioButton)
                            .addComponent(inglesARadioButton)
                            .addComponent(francesARadioButton)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(matriculaLabel)
                        .addGap(10, 10, 10)
                        .addComponent(matriculaText, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(telALabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(telAText, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(151, 151, 151)
                        .addComponent(cadastrarAButton)
                        .addGap(26, 26, 26)
                        .addComponent(voltarAButton, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(endALabel)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(endAText))
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(idadeALabel)
                                .addComponent(sexoALabel))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(mascARadioButton)
                                    .addGap(18, 18, 18)
                                    .addComponent(femARadioButton))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(idadeAText, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(39, 39, 39)
                                    .addComponent(cpfALabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(cpfAText))))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                            .addComponent(nomeALabel)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(nomeAText, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(22, 22, 22))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeALabel)
                    .addComponent(nomeAText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(matriculaText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(matriculaLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(idadeALabel)
                    .addComponent(idadeAText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cpfAText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cpfALabel))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(sexoALabel)
                    .addComponent(mascARadioButton)
                    .addComponent(femARadioButton))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(telALabel)
                    .addComponent(telAText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(endALabel)
                    .addComponent(endAText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nometurmaLabel)
                    .addComponent(codTurmaAText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(linguaALabel)
                    .addComponent(inglesARadioButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(espanholARadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(francesARadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(voltarAButton)
                    .addComponent(cadastrarAButton))
                .addContainerGap())
        );

        cadastrarTabbedPane.addTab("Aluno", jPanel2);

        nomeFLabel.setText("Nome :");

        idadeFLabel.setText("Idade :");

        cpfFLabel.setText("CPF :");

        sexoFLabel.setText("Sexo :");

        buttonGroup5.add(mascFRadioButton);
        mascFRadioButton.setText("M");

        buttonGroup5.add(femFRadioButton);
        femFRadioButton.setText("F");

        telFLabel.setText("Telefone :");

        endFLabel.setText("Endereço :");

        salarioLabel.setText("Salário :");

        cadastrarFButton.setText("Cadastrar");
        cadastrarFButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastrarFButtonActionPerformed(evt);
            }
        });

        voltarFButton.setText("Voltar");
        voltarFButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                voltarFButtonActionPerformed(evt);
            }
        });

        disciplinaLabel.setText("Disciplina :");

        jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        buttonGroup4.add(dirRadioButton);
        dirRadioButton.setText("Diretor");
        dirRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dirRadioButtonActionPerformed(evt);
            }
        });

        buttonGroup4.add(profRadioButton);
        profRadioButton.setText("Professor");
        profRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                profRadioButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(profRadioButton)
                .addGap(91, 91, 91)
                .addComponent(dirRadioButton)
                .addContainerGap(116, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(dirRadioButton)
                .addComponent(profRadioButton))
        );

        codTurmaPLabel.setText("Turma : ");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(nomeFLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(nomeFText, javax.swing.GroupLayout.PREFERRED_SIZE, 297, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(telFLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(telFText, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(salarioLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(salarioText, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(157, 157, 157)
                                .addComponent(cadastrarFButton)
                                .addGap(22, 22, 22)
                                .addComponent(voltarFButton, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE))
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                    .addComponent(disciplinaLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(disciplinaText))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                    .addComponent(endFLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(endFText))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(sexoFLabel)
                                        .addComponent(idadeFLabel))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(mascFRadioButton)
                                        .addComponent(idadeFText, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel3Layout.createSequentialGroup()
                                            .addGap(36, 36, 36)
                                            .addComponent(cpfFLabel)
                                            .addGap(10, 10, 10)
                                            .addComponent(cpfFText, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE))
                                        .addGroup(jPanel3Layout.createSequentialGroup()
                                            .addGap(18, 18, 18)
                                            .addComponent(femFRadioButton)))))
                            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(24, 24, 24))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(codTurmaPLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(codTurmaPText, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeFLabel)
                    .addComponent(nomeFText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(idadeFLabel)
                    .addComponent(cpfFLabel)
                    .addComponent(idadeFText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cpfFText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(sexoFLabel)
                    .addComponent(mascFRadioButton)
                    .addComponent(femFRadioButton))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(telFLabel)
                    .addComponent(telFText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(19, 19, 19)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(endFLabel)
                    .addComponent(endFText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salarioLabel)
                    .addComponent(salarioText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(disciplinaLabel)
                    .addComponent(disciplinaText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(codTurmaPLabel)
                    .addComponent(codTurmaPText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 47, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cadastrarFButton)
                    .addComponent(voltarFButton))
                .addContainerGap())
        );

        cadastrarTabbedPane.addTab("Funcionário", jPanel3);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(cadastrarTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(cadastrarTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cadastrarTButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastrarTButtonActionPerformed
        Map<String, String> entrada = new HashMap();
        entrada.put("nome", nomeTText.getText());
        if (serieComboBox.getSelectedIndex() == 0) {
            entrada.put("serie", "1ª");
        }
        if (serieComboBox.getSelectedIndex() == 1) {
            entrada.put("serie", "2ª");
        }
        if (serieComboBox.getSelectedIndex() == 2) {
            entrada.put("serie", "3ª");
        }

        if (turnoComboBox.getSelectedIndex() == 0) {
            entrada.put("turno", "manhã");
        }
        if (turnoComboBox.getSelectedIndex() == 1) {
            entrada.put("turno", "tarde");
        }
        if (turnoComboBox.getSelectedIndex() == 2) {
            entrada.put("turno", "noite");
        }


        if (inglesTRadioButton.isSelected()) {
            entrada.put("lingua", "Ingles");
        }
        if (espanholTRadioButton.isSelected()) {
            entrada.put("lingua", "Espanhol");
        }
        if (francesTRadioButton.isSelected()) {
            entrada.put("lingua", "Frances");
        }

        Map<String, String> saida = null;
        try {
            saida = Fachada.ComandoCriaTurma(entrada);
        } catch (Exception ex) {
            Logger.getLogger(Cadastra.class.getName()).log(Level.SEVERE, null, ex);
        }
        JOptionPane.showMessageDialog(rootPane, saida.get("msg"));
        nomeTText.setText("");
        serieComboBox.setSelectedItem("1ª");
        turnoComboBox.setSelectedItem("manhã");
        buttonGroup1.clearSelection();


    }//GEN-LAST:event_cadastrarTButtonActionPerformed

    private void voltarTButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_voltarTButtonActionPerformed
        this.dispose();
    }//GEN-LAST:event_voltarTButtonActionPerformed

    private void cadastrarAButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastrarAButtonActionPerformed
        Map<String, String> entrada = new HashMap();
        entrada.put("codTurma", codTurmaAText.getText());

        entrada.put("nome", nomeAText.getText());
        entrada.put("matricula", matriculaText.getText());
        entrada.put("idade", idadeAText.getText());
        entrada.put("cpf", cpfAText.getText());
        if (mascARadioButton.isSelected()) {
            entrada.put("sexo", "M");
        }
        if (femARadioButton.isSelected()) {
            entrada.put("sexo", "F");
        }
        entrada.put("tel", telAText.getText());
        entrada.put("end", endAText.getText());
        if (inglesARadioButton.isSelected()) {
            entrada.put("lingua", "Ingles");
        }
        if (espanholARadioButton.isSelected()) {
            entrada.put("lingua", "Espanhol");
        }
        if (francesARadioButton.isSelected()) {
            entrada.put("lingua", "Frances");
        }

        Map<String, String> saida = null;
        try {
            saida = Fachada.ComandoCriaAluno(entrada);
        } catch (Exception ex) {
            Logger.getLogger(Cadastra.class.getName()).log(Level.SEVERE, null, ex);
        }
        JOptionPane.showMessageDialog(rootPane, saida.get("msg"));

        nomeAText.setText("");
        matriculaText.setText("");
        idadeAText.setText("");
        cpfAText.setText("");
        buttonGroup2.clearSelection();
        telAText.setText("");
        endAText.setText("");
        codTurmaAText.setText("");
        buttonGroup3.clearSelection();

    }//GEN-LAST:event_cadastrarAButtonActionPerformed

    private void voltarAButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_voltarAButtonActionPerformed
        this.dispose();
    }//GEN-LAST:event_voltarAButtonActionPerformed

    private void cadastrarFButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastrarFButtonActionPerformed
        Map<String, String> entrada = new HashMap();

        if (dirRadioButton.isSelected()) {
            entrada.put("nome", nomeFText.getText());
            entrada.put("idade", idadeFText.getText());
            entrada.put("cpf", cpfFText.getText());
            if (mascFRadioButton.isSelected()) {
                entrada.put("sexo", "M");
            }
            if (femFRadioButton.isSelected()) {
                entrada.put("sexo", "F");
            }
            entrada.put("tel", telFText.getText());
            entrada.put("end", endFText.getText());
            entrada.put("salario", salarioText.getText());
            Map<String, String> saida = null;
            try {
                saida = Fachada.ComandoCriaDiretor(entrada);
            } catch (Exception ex) {
                Logger.getLogger(Cadastra.class.getName()).log(Level.SEVERE, null, ex);
            }
            JOptionPane.showMessageDialog(rootPane, saida.get("msg"));

        } else if (profRadioButton.isSelected()) {
            
            entrada.put("codTurma", codTurmaPText.getText());

            entrada.put("nome", nomeFText.getText());
            entrada.put("idade", idadeFText.getText());
            entrada.put("cpf", cpfFText.getText());
            if (mascFRadioButton.isSelected()) {
                entrada.put("sexo", "M");
            }
            if (femFRadioButton.isSelected()) {
                entrada.put("sexo", "F");
            }
            entrada.put("tel", telFText.getText());
            entrada.put("end", endFText.getText());
            entrada.put("salario", salarioText.getText());
            entrada.put("disciplina", disciplinaText.getText());
            
            Map<String, String> saida = null;
            try {
                saida = Fachada.ComandoCriaProfessor(entrada);
            } catch (Exception ex) {
                Logger.getLogger(Cadastra.class.getName()).log(Level.SEVERE, null, ex);
            }
            JOptionPane.showMessageDialog(rootPane, saida.get("msg"));


        } else {
            JOptionPane.showMessageDialog(rootPane, "Selecione um tipo de funcionário!");
        }



        buttonGroup4.clearSelection();
        nomeFText.setText("");
        idadeFText.setText("");
        cpfFText.setText("");
        buttonGroup5.clearSelection();
        telFText.setText("");
        endFText.setText("");
        salarioText.setText("");
        disciplinaText.setText("");
    }//GEN-LAST:event_cadastrarFButtonActionPerformed

    private void voltarFButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_voltarFButtonActionPerformed
        this.dispose();
    }//GEN-LAST:event_voltarFButtonActionPerformed

    private void dirRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirRadioButtonActionPerformed
        disciplinaLabel.setVisible(false);
        disciplinaText.setVisible(false);
        codTurmaPLabel.setVisible(false);
        codTurmaPText.setVisible(false);
    }//GEN-LAST:event_dirRadioButtonActionPerformed

    private void profRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_profRadioButtonActionPerformed
        disciplinaLabel.setVisible(true);
        disciplinaText.setVisible(true);
    }//GEN-LAST:event_profRadioButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Cadastra().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.ButtonGroup buttonGroup4;
    private javax.swing.ButtonGroup buttonGroup5;
    private javax.swing.JButton cadastrarAButton;
    private javax.swing.JButton cadastrarFButton;
    private javax.swing.JButton cadastrarTButton;
    private javax.swing.JTabbedPane cadastrarTabbedPane;
    private javax.swing.JTextField codTurmaAText;
    private javax.swing.JLabel codTurmaPLabel;
    private javax.swing.JTextField codTurmaPText;
    private javax.swing.JLabel cpfALabel;
    private javax.swing.JTextField cpfAText;
    private javax.swing.JLabel cpfFLabel;
    private javax.swing.JTextField cpfFText;
    private javax.swing.JRadioButton dirRadioButton;
    private javax.swing.JLabel disciplinaLabel;
    private javax.swing.JTextField disciplinaText;
    private javax.swing.JLabel endALabel;
    private javax.swing.JTextField endAText;
    private javax.swing.JLabel endFLabel;
    private javax.swing.JTextField endFText;
    private javax.swing.JRadioButton espanholARadioButton;
    private javax.swing.JRadioButton espanholTRadioButton;
    private javax.swing.JRadioButton femARadioButton;
    private javax.swing.JRadioButton femFRadioButton;
    private javax.swing.JRadioButton francesARadioButton;
    private javax.swing.JRadioButton francesTRadioButton;
    private javax.swing.JLabel idadeALabel;
    private javax.swing.JTextField idadeAText;
    private javax.swing.JLabel idadeFLabel;
    private javax.swing.JTextField idadeFText;
    private javax.swing.JRadioButton inglesARadioButton;
    private javax.swing.JRadioButton inglesTRadioButton;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JLabel linguaALabel;
    private javax.swing.JLabel linguaTLabel;
    private javax.swing.JRadioButton mascARadioButton;
    private javax.swing.JRadioButton mascFRadioButton;
    private javax.swing.JLabel matriculaLabel;
    private javax.swing.JTextField matriculaText;
    private javax.swing.JLabel nomeALabel;
    private javax.swing.JTextField nomeAText;
    private javax.swing.JLabel nomeFLabel;
    private javax.swing.JTextField nomeFText;
    private javax.swing.JLabel nomeTLabel;
    private javax.swing.JTextField nomeTText;
    private javax.swing.JLabel nometurmaLabel;
    private javax.swing.JRadioButton profRadioButton;
    private javax.swing.JLabel salarioLabel;
    private javax.swing.JTextField salarioText;
    private javax.swing.JComboBox serieComboBox;
    private javax.swing.JLabel serieLabel;
    private javax.swing.JLabel sexoALabel;
    private javax.swing.JLabel sexoFLabel;
    private javax.swing.JLabel telALabel;
    private javax.swing.JTextField telAText;
    private javax.swing.JLabel telFLabel;
    private javax.swing.JTextField telFText;
    private javax.swing.JComboBox turnoComboBox;
    private javax.swing.JLabel turnoLabel;
    private javax.swing.JButton voltarAButton;
    private javax.swing.JButton voltarFButton;
    private javax.swing.JButton voltarTButton;
    // End of variables declaration//GEN-END:variables
}
